<?php
/**
 * Created by PhpStorm.
 * User: FDG296
 * Date: 2017/7/10
 * Time: 15:33
 */
namespace common\models;

use Yii;
use yii\db\ActiveRecord;

class CategoryRecommendGoods extends ActiveRecord{
    public static function tableName(){
        return '{{%category_recommend_goods}}';
    }

    public function getGoodsList($id){
        $where = ['use_flg'=>1,'category_recommend_id'=>$id];
        $result = $this::find()->where($where)->orderBy('sort asc')->select('main_goods_id')->asArray()->all();
        if(!empty($result)){
            $main_goods_id = array_column($result,'main_goods_id');
        }else{
            $main_goods_id = array();
        }

        return $main_goods_id;
    }
}